﻿CREATE FUNCTION [audit].[IsTraceActive]
(@TraceName NVARCHAR (256))
RETURNS BIT
AS
BEGIN
	DECLARE @ReturnValue bit

	IF EXISTS(
		SELECT * FROM :: fn_trace_getinfo(default)
		WHERE (RTRIM(CAST([value] AS varchar(255))) = @TraceName)
	)
		SET @ReturnValue = 1
	ELSE
		SET @ReturnValue = 0

	RETURN(@ReturnValue)
END